#include <REGX52.H>
#include <INTRINS.H>
#include "timer0.h"




void main()
{
	Timer0_Init();		//定时器T0初始化
	
	P2_0 = 0;
	while(1)
	{
		
	}
}

/**
  * @brief  定时器0中断处理函数模版
  * @param  无
  * @retval 无
  */
void Timer_Routine(void) interrupt 1
{
	static unsigned int count = 0;
	
	count++;
	//P2_0 = 0;
	if(count >= 500)		//定时器T0每1ms中断一次，进入1000次经过了1s
	{
		P2_0 = ~P2_0;
		count = 0;
	}
	
	//定时器溢出之后需要重新装载
	TH0 = (65535 - 1000) / 256;					//12MHz晶振，12分频
	TL0 = (65535 - 1000) % 256 + 1; 			//
}
